package com.liusr.template.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Liusr
 * @date 2023/1/23
 * @package com.liusr.template.interceptor
 * @Description: 登录校验拦截器配置
 */
@Configuration
public class LoginCheckInterceptorConfig implements WebMvcConfigurer {
	@Bean
	public LoginCheckInterceptor loginCheckInterceptor() {
		return new LoginCheckInterceptor();
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//TODO 这里的拦截器拦截路径后期自己可以改
		registry.addInterceptor(loginCheckInterceptor())
				.addPathPatterns("/**")
				.excludePathPatterns("/login","/register");
	}
}
